<?php

class IndexController extends Zend_Controller_Action
{
	protected $_department;
	protected $_categories;
    protected $_content;
    protected $_categoryAlias = 'news'; //hardcode :(

	public function init() {        
        $this->_department = new Application_Model_Department();    
        $this->_categories = new Application_Model_Categories();
        $this->_content    = new Application_Model_Content();
	}

    public function indexAction() {
        /*$allContent = $this->_content->getAllContent();            
        foreach ($allContent as $content) {
            $text = preg_replace('/uploads/', 'public/uploads', $content['text']);            
            $previewText = preg_replace('/uploads/', 'public/uploads', $content['preview_text']);            
            $this->_content->updateContent(
                $content['id'],
                array(
                    'preview_text' => $previewText,
                    'text'         => $text
                )
            );
            var_dump($content['preview_text']);
            //var_dump($text);            
        }
        die();
        var_dump($allContent);*/        
        $this->view->category = 'news'; //temporary hardcode
        $this->_helper->_block->add('mainVideo');
        $this->_helper->_block->add('tabs');
        $this->_helper->_block->add('socialWidget');
        $this->_helper->_block->add('popularNews');
        $this->_helper->_block->add('announcements');
        $this->_helper->_block->add('slider');   
        $this->_helper->_block->add('sites');     
        $this->_helper->_block->add('otherSites');
        /*$categoryId    = $this->_categories->getCategoryIdByAliasAndDepartmentId('news');       
        $allContent    = $this->_content->getContentByCategoryId($categoryId);

        $content = $this->_content->makePreviewForFeed($allContent);
        $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($content));
        $paginator->setCurrentPageNumber($this->_getParam('page', 1));
        $paginator->setItemCountPerPage(4); 
        $paginator->setPageRange(4);
        $this->view->content = $paginator;*/
        //var_dump(Zend_auth::getInstance()->getIdentity());
        //exit();      
        //$departments = $this->_department->getAllDepartments();
        //$this->view->departments = $departments;

        //hardcode :(        
        //$this->view->specialty = $this->_categories->getCategoriesByParentId($this->_specialtyId);
    }   
}

